package com.hz.monitoring.module.hardware.dal.mysql.mcu_sys_type;

import com.hz.monitoring.framework.common.pojo.PageResult;
import com.hz.monitoring.framework.mybatis.core.mapper.BaseMapperX;
import com.hz.monitoring.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hz.monitoring.module.hardware.controller.admin.mcu_sys_type.vo.McuSysTypeExportReqVO;
import com.hz.monitoring.module.hardware.controller.admin.mcu_sys_type.vo.McuSysTypeListReqVO;
import com.hz.monitoring.module.hardware.controller.admin.mcu_sys_type.vo.McuSysTypePageReqVO;
import com.hz.monitoring.module.hardware.dal.dataobject.mcu_sys_type.McuSysTypeDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * MCU系统分类 Mapper
 *
 * @author lin
 */
@Mapper
public interface McuSysTypeMapper extends BaseMapperX<McuSysTypeDO> {

    default PageResult<McuSysTypeDO> selectPage(McuSysTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<McuSysTypeDO>()
                .eqIfPresent(McuSysTypeDO::getModel, reqVO.getModel())
                .likeIfPresent(McuSysTypeDO::getName, reqVO.getName())
                .eqIfPresent(McuSysTypeDO::getSpecification, reqVO.getSpecification())
                .eqIfPresent(McuSysTypeDO::getVendor, reqVO.getVendor())
                .eqIfPresent(McuSysTypeDO::getEdition, reqVO.getEdition())
                .betweenIfPresent(McuSysTypeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(McuSysTypeDO::getId));
    }

    default List<McuSysTypeDO> selectList(McuSysTypeListReqVO listVO) {
        return selectList(new LambdaQueryWrapperX<McuSysTypeDO>()
                .eqIfPresent(McuSysTypeDO::getModel, listVO.getModel())
                .likeIfPresent(McuSysTypeDO::getName, listVO.getName())
                .eqIfPresent(McuSysTypeDO::getSpecification, listVO.getSpecification())
                .eqIfPresent(McuSysTypeDO::getVendor, listVO.getVendor())
                .eqIfPresent(McuSysTypeDO::getEdition, listVO.getEdition())
                .inIfPresent(McuSysTypeDO::getId,listVO.getIds())
                .betweenIfPresent(McuSysTypeDO::getCreateTime, listVO.getBeginCreateTime(), listVO.getEndCreateTime())
                .orderByDesc(McuSysTypeDO::getId));
    }

    default List<McuSysTypeDO> selectList(McuSysTypeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<McuSysTypeDO>()
                .eqIfPresent(McuSysTypeDO::getModel, reqVO.getModel())
                .likeIfPresent(McuSysTypeDO::getName, reqVO.getName())
                .eqIfPresent(McuSysTypeDO::getSpecification, reqVO.getSpecification())
                .eqIfPresent(McuSysTypeDO::getVendor, reqVO.getVendor())
                .eqIfPresent(McuSysTypeDO::getEdition, reqVO.getEdition())
                .betweenIfPresent(McuSysTypeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(McuSysTypeDO::getId));
    }

}
